Fix sets manager import form selection multiple default option selected issue. #2880
+16
−10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently when the sets manager page loads the "Import how many sets?" select has "a single set" initially selected and the "Import from where?" select has "Select filenames below" selected. But then if you change the first select to "multiple sets" the "Import from where?" select still has "Select filenames below" selected. Furthermore, if you then click on that select and use shift-down arrow to select multiple sets, that first disabled option stays selected. Then form validation fails for that option since it has no value if you click the "Import" button.
This just makes it so that when you switch from the "Import how many sets?" select from "a single set" to "multiple sets", that first option in the "Import from where?" select is immediately unselected.
There is also a little clean up of this section of JavaScript code. The elements with id
import_source_selectand nameaction.import.numberare actually the same element, so no need to find them in the DOM twice. Also ensure the elements exist and are found before trying to work with them. More of this is needed in this file, but this is probably good enough for now.